package base.utils;

public enum StringEnum {

	/*枚举的值*/
	BEFORE,ALL,ACCEPTED,FINISHED,FOLLOW,FAILED,NOVALUE,
	
	/*order的枚举*/
	JG,RQ,XP,XL,SC;
	/**
	 * String转换为枚举类型
	 * 
	 * @return StringEnum
	 * 			枚举类型的结果
	 * */
	public static StringEnum toValue(String str){
		try{
			return valueOf(str.toUpperCase());
		}catch(Exception ex){
			return NOVALUE;
		}
	}
	
	public static void main(String[] args) {
		String str = null;
		StringEnum senum = StringEnum.toValue(str);
		switch(senum){
		case BEFORE:
			System.out.println("before");
			break;
		case NOVALUE:
			System.out.println("null");
			break;
		default:
			System.out.println(senum);
			break;
		}
	}
}